import request from '../../request/request.js'
Page({

  data: {
    awardList:[],
    rankList:[],
    hasList:false
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.getRank();
  },
  getRank(){
    var that = this
    request({
      url:'coach/rank',
      method:'post'
    }).then(res=>{
      if(res.data.success){
        let list = res.data.data
        console.log(list);
        
        if(list.length>3){
          console.log('进来了');
          
          that.setData({awardList:list.slice(0,3)})
          that.setData({rankList:list.slice(3,list.length)})
          that.setData({hasList:true})
        }else{
          console.log("长度不够");
          
          that.setData({awardList:list})
        }
      }
    }).catch(err=>{})
  }
})